package com.zzy.util;

import javax.servlet.http.HttpServletRequest;

/**
 * 判断浏览器
 */
public class UtilBrowser {


    /** 判断是否是IE浏览器*/
    public static boolean  isIEBrowser(HttpServletRequest request) {
        String[] IEBrowserSignals = {"MSIE", "Trident", "Edge"};
        String userAgent = request.getHeader("User-Agent");
        for (String signal : IEBrowserSignals) {
            if (userAgent.contains(signal)) {
                return true;
            }
        }
        return false;
    }


    /**判断是否是Chrome 谷歌 浏览器*/
    public static boolean isChromeBrowser(HttpServletRequest request) {
        String userAgent = request.getHeader("User-Agent");
        if (userAgent.contains("Chrome")) {
            return true;
        }
        return false;
    }

    /**判断是否是Firefox 火狐 浏览器*/
    public static boolean isFirefoxBrowser(HttpServletRequest request) {
        String userAgent = request.getHeader("User-Agent");
        if (userAgent.contains("Chrome")) {
            return true;
        }
        return false;
    }

}
